package bangry.chat.util.server.util;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.util.Enumeration;

import javax.swing.UIManager;

public class GUIUtil {
	// 화면 중앙 배치 
	public static void setCenterScreen(Container con){
		Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
		int centerX = (screenDim.width - con.getWidth()) / 2;
		int centerY = (screenDim.height - con.getHeight()) / 2;
		con.setLocation(centerX, centerY);	
	}
	
	// 화면 풀스크린 설정 
	public static void setFullScreen(Container con){
		Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
		con.setSize(screenDim);	
	}
	
	// 모든 컴포넌트 설정하기
	public static void setUIFont(Font font){
		//listB.setFont(new Font("굴림", Font.PLAIN, 12));
		// 모든 컴포넌트에 사용자 폰트 설정
		Enumeration e = UIManager.getDefaults().keys();
		while(e.hasMoreElements()){
			String key = (String) e.nextElement();
			if(key.endsWith(".font")){
				UIManager.put(key, font);
			}
		}
		
		
		
	}


}
